<template>
	<view style="width: 100%;text-align: center;">
		<index-tabbar :tabBars="tabBars" @TarTap="TarData" :tabIndex="tabIndex" ></index-tabbar>
		<!-- 每个tab标题对应的具体组件内容 -->
		<component v-bind:is="currentTabComponent"></component>
		
	</view>
	
</template>
 
<script>
	import indexTabbar from '../components/tabBar.vue';
    //推荐选项卡  具体内容
	import focusOn from './focus.vue';
    //关注选项卡  具体内容
	import recomment from './recomment.vue';
	import activity from './activities.vue';
	
	export default {
		components:{
			indexTabbar,
			focusOn,
			recomment,
			activity
		},
		data() {
			return {
				title: 'Hello',
				tabIndex: "recomment",
				tabBars:[
					{
						name: "关注",
						id: "focusOn"
					},
					{
						name:"推荐",
						id:"recomment"
					},
					{
						name: "活动",
						id: "activity"
					},
					
					
					
				],
				currentTabComponent: "recomment"
			}
		},
		methods:{
			TarData(item){
				//设置id，来显示选中那个标签，显示下划线
				this.tabIndex = item.id;
				//显示标签对应的组件内容
				this.currentTabComponent = item.id
			}
		}
	}
</script>
 
<style>
</style>